package com.msh.artascope.devcloud.client.po;


import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BasePo;
import com.msh.frame.client.validation.IInsertVo;
import com.msh.frame.client.validation.IUpdateVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author shihu
 * @mail m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "环境信息Po")
public class EnvPo extends BasePo{
  @NotNull(groups = {IUpdateVo.class}, message = "id不能为空")
  @Schema(name = "主键id")
  private Long id;

  @NotNull(groups = {IInsertVo.class},message = "环境不能为空")
  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 20, message = "env长度范围最大20")
  @Schema(name = "环境")
  private String env;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 50, message = "namespace长度范围最大50")
  @Schema(name = "命名空间")
  private String namespace;

  @Schema(name = "租户")
  private Long tenantId;



  public void initLoginAccount(ILoginAccount loginAccount){
    this.tenantId = loginAccount.getTenantId();
  }
}



